package com.mall.api.user.fallback;

import com.mall.api.user.UserFeignClient;
import com.mall.api.user.dto.UserDTO;
import com.mall.common.result.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class UserFeignFallback implements UserFeignClient {

    @Override
    public Result<UserDTO> getUserById(Long id) {
        log.error("用户服务调用失败，进入熔断降级处理，getUserById，id: {}", id);
        return Result.error(500, "用户服务不可用");
    }

    @Override
    public Result<UserDTO> getUserByUsername(String username) {
        log.error("用户服务调用失败，进入熔断降级处理，getUserByUsername，username: {}", username);
        return Result.error(500, "用户服务不可用");
    }

    @Override
    public Result<Void> register(UserDTO userDTO) {
        log.error("用户服务调用失败，进入熔断降级处理，register，username: {}", userDTO.getUsername());
        return Result.error(500, "用户服务不可用");
    }

    @Override
    public Result<Void> updateUser(UserDTO userDTO) {
        log.error("用户服务调用失败，进入熔断降级处理，updateUser，id: {}", userDTO.getId());
        return Result.error(500, "用户服务不可用");
    }

    @Override
    public Result<Void> deleteUser(Long id) {
        log.error("用户服务调用失败，进入熔断降级处理，deleteUser，id: {}", id);
        return Result.error(500, "用户服务不可用");
    }
} 